package common.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 用于页面跳转的Controller
 * 
 * @author liuxj
 * @version 1.0.0 2017-07-12
 */
@Controller
@RequestMapping(value = "/page/*")
public class PageController {
    
    /**
     * 用于跳转到JSP页面的Action
     * 
     * @param jspName
     *            JSP页面名称
     * @return JSP页面
     */
    @RequestMapping(value = "/{jspName}")
    public String toPage(@PathVariable String jspName){
        return jspName;
    }
    
    /**
     * 用于跳转到JSP页面的Action
     * 
     * @param folder
     *            文件夹名称
     * @param jspName
     *            JSP页面名称
     * @return JSP页面
     */
    @RequestMapping(value = "/{folder}/{jspName}")
    public String toPage(@PathVariable String folder, @PathVariable String jspName){
        return folder + "/" + jspName;
    }

    /**
     * 用于跳转到JSP页面的Action
     * 
     * @param folder1
     *            文件夹名称1
     * @param folder2
     *            文件夹名称2
     * @param jspName
     *            JSP页面名称
     * @return JSP页面
     */
    @RequestMapping(value = "/{folder1}/{folder2}/{jspName}")
    public String toPage(@PathVariable String folder1, @PathVariable String folder2, @PathVariable String jspName){
        return folder1 + "/" + folder2 + "/" + jspName;
    }

}
